/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Interface;

import LN.Alquileres.Hospedaje;
import LN.Alquileres.Tarifa_Habitacion;
import LN.Visitante.Visitante;
import LN.Varios.Hosteria;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Calendar;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

/**
 *
 * @author Lukas
 */
public class Huespedes extends javax.swing.JPanel {

    /**
     * Creates new form Huespedes
     */
    public Huespedes(Hosteria unaHosteria) {
        this.unaHosteria = unaHosteria;
        initComponents();
        carcar_Alquileres();

        for (Tarifa_Habitacion unTarifa : unaHosteria.getTarifas()) {
            cbx_Tarifas_Hab.addItem(unTarifa);
        }

        cbx_Tarifas_Hab.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent ie) {
                if (cbx_Tarifas_Hab.getSelectedIndex() != -1) {
                    Tarifa_Habitacion unaTarifa = (Tarifa_Habitacion) cbx_Tarifas_Hab.getSelectedItem();

                    switch (unaTarifa.getTipo()) {
                        case "Single":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));
                        case "Doble Matrimonial":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));
                        case "Doble Separada":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));
                        case "Matrimonial + 1":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));
                        case "Trible Separada":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));
                        case "Matrimonial + 2":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));
                        case "Cuadruble Separada":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));
                        case "Sin Cargo":
                            txt_Precio_Unitario.setText(String.valueOf(unaTarifa.getPrecio()));

                    }
                }
            }
        });

        tbl_hospedajes.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent lse) {
                Hospedaje unHospedaje = (Hospedaje) tbl_hospedajes.getValueAt(tbl_hospedajes.getSelectedRow(), 1);
                Visitante unVisitante = (unHospedaje).getUnVisitante();

                txt_Total.setText(String.valueOf((unHospedaje.getUnaTarifa_Habitacion().getPrecio()) * (calcularTotal(unHospedaje))));

                txt_apellido_vis.setText(unVisitante.getApellido());
                txt_Nombre_Vis.setText(unVisitante.getNombre());
                txt_ocupacion.setText(unVisitante.getOcupacion());
                txt_motivoVis.setText(unVisitante.getMotivo_visita());
                txt_telefono.setText(unVisitante.getTelefono());
                txt_EstadoCivil.setText(unVisitante.getEstado_civil().toString());
                txt_Email_Vis.setText(unVisitante.getE_mail());
                txt_sexoVis.setText(unVisitante.getSexo().toString());
                txt_Pais_vis.setText(unVisitante.getDireccion().getPais().toString());
                txt_Porvincia_Vis.setText(unVisitante.getDireccion().getProvincia().toString());
                txt_Localidad_Vis.setText(unVisitante.getDireccion().getLocalidad().toString());
                txt_Domicilio_Vis.setText(unVisitante.getDomicilio());
                txt_CondAf_Vis.setText(unVisitante.getCondicion_af());
                txt_Documento_Vis.setText(unVisitante.getDni());
                txt_FechaNac_Vis.setText(unVisitante.getFnac().toString());
                txt_representante.setText(unVisitante.getApellido() +" "+ unVisitante.getNombre());
                

                for (int i = 0; i < cbx_Tarifas_Hab.getItemCount() - 1; i++) {

                    if (unHospedaje.getUnaTarifa_Habitacion().getTipo().equals(((Tarifa_Habitacion) cbx_Tarifas_Hab.getItemAt(i)).getTipo())) {
                        cbx_Tarifas_Hab.setSelectedIndex(i);
                        break;
                    }
                }
                GUIM.cargarCuentasHuesped(tbl_Cuentas_Huesped, unHospedaje);

            }
        });

        txt_Descuento.addCaretListener(new CaretListener() {
            @Override
            public void caretUpdate(CaretEvent ce) {
                calcularDescuento();
            }
        });


    }

    private void carcar_Alquileres() {
        GUIM.cargarTablaHospedajes(tbl_hospedajes, unaHosteria.getAlquileres());
    }



    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tbl_hospedajes = new javax.swing.JTable();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        txt_Nombre_Vis = new javax.swing.JTextField();
        txt_apellido_vis = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txt_telefono = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        txt_Email_Vis = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        txt_ocupacion = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        txt_sexoVis = new javax.swing.JTextField();
        txt_EstadoCivil = new javax.swing.JTextField();
        txt_motivoVis = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        lbl_tipoDNI = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        txt_CondAf_Vis = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        txt_nro_carnet = new javax.swing.JTextField();
        txt_Documento_Vis = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        txt_FechaNac_Vis = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        txt_Pais_vis = new javax.swing.JTextField();
        txt_Porvincia_Vis = new javax.swing.JTextField();
        txt_Localidad_Vis = new javax.swing.JTextField();
        txt_Domicilio_Vis = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        dp_diaIN = new org.jdesktop.swingx.JXDatePicker();
        dp_diaOUT = new org.jdesktop.swingx.JXDatePicker();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        lbl_horaIN = new javax.swing.JLabel();
        lbl_horaOUT = new javax.swing.JLabel();
        txt_Precio_Unitario = new javax.swing.JTextField();
        txt_Descuento = new javax.swing.JTextField();
        txt_Total = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        cbx_Tarifas_Hab = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        txt_representante = new javax.swing.JTextField();
        txt_1 = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tbl_Cuentas_Huesped = new javax.swing.JTable();
        lbl_titulo = new javax.swing.JTextField();
        panelRect1 = new org.edisoncor.gui.panel.PanelRect();
        btn_Capturar_Visitante = new javax.swing.JButton();
        btn_listarCaja = new javax.swing.JButton();
        btn_Capturar_Reserva = new javax.swing.JButton();
        btn_Ingresar_Mov = new javax.swing.JButton();
        jXTaskPane1 = new org.jdesktop.swingx.JXTaskPane();
        jXSearchField2 = new org.jdesktop.swingx.JXSearchField();

        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.LINE_AXIS));

        tbl_hospedajes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Hab.", "Huesped"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(tbl_hospedajes);

        jPanel2.add(jScrollPane2);

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Personales"));
        jPanel6.setPreferredSize(new java.awt.Dimension(615, 238));

        jLabel7.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel7.setText("Nombre:");

        jLabel8.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel8.setText("Apellido:");

        jLabel9.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel9.setText("Sexo:");

        jLabel10.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel10.setText("Telefono:");

        jLabel12.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel12.setText("E-mail:");

        jLabel18.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel18.setText("Ocupacion:");

        jLabel11.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel11.setText("Estado Civil:");

        jLabel15.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel15.setText("Motivo de Visita:");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_Nombre_Vis))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addGap(18, 18, 18)
                        .addComponent(txt_Email_Vis))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel18)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txt_ocupacion)
                            .addComponent(txt_telefono))))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_motivoVis))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_apellido_vis, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel11))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txt_EstadoCivil)
                            .addComponent(txt_sexoVis)))))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(txt_Nombre_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(txt_apellido_vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(txt_ocupacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15)
                    .addComponent(txt_motivoVis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(txt_telefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11)
                    .addComponent(txt_EstadoCivil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(txt_Email_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(txt_sexoVis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Documentación"));

        lbl_tipoDNI.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        lbl_tipoDNI.setText("Identificacion:");

        jLabel14.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel14.setText("Condicion de Afiliacion:");

        jLabel17.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel17.setText("Nro. de Carnet:");

        jLabel13.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel13.setText("Fecha de Nacimiento:");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createSequentialGroup()
                        .addComponent(lbl_tipoDNI)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_Documento_Vis))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_CondAf_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_FechaNac_Vis, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_nro_carnet)))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(txt_CondAf_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(txt_nro_carnet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lbl_tipoDNI)
                        .addComponent(txt_Documento_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel13)
                        .addComponent(txt_FechaNac_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Procedencia"));

        jLabel16.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel16.setText("Domicilio:");

        jLabel19.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel19.setText("País:");

        jLabel20.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel20.setText("Provincia:");

        jLabel21.setFont(new java.awt.Font("Footlight MT Light", 0, 18)); // NOI18N
        jLabel21.setText("Localidad");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_Pais_vis, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_Localidad_Vis)))
                .addGap(42, 42, 42)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel20)
                    .addComponent(jLabel16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txt_Porvincia_Vis, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
                    .addComponent(txt_Domicilio_Vis))
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(txt_Pais_vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20)
                    .addComponent(txt_Porvincia_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(txt_Localidad_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16)
                    .addComponent(txt_Domicilio_Vis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE)
            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(45, 45, 45))
        );

        jTabbedPane1.addTab("Principales", new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Havell.png")), jPanel4); // NOI18N

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles de Alojamiento"));

        jLabel1.setText("Fecha y Hora de Ingreso:");

        jLabel2.setText("Fecha y Hora de Egreso");

        lbl_horaIN.setBackground(new java.awt.Color(153, 204, 0));

        lbl_horaOUT.setBackground(new java.awt.Color(153, 204, 0));
        lbl_horaOUT.setText("12:00");

        txt_Precio_Unitario.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txt_Precio_UnitarioCaretUpdate(evt);
            }
        });

        jLabel3.setText("Precio Unitario:");

        jLabel4.setText("Descuento %:");

        jLabel5.setText("TOTAL:");

        jLabel6.setText("Tarifa");

        jLabel22.setText("Representante:");

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_representante, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(dp_diaIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lbl_horaIN, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(txt_Descuento)
                    .addComponent(cbx_Tarifas_Hab, javax.swing.GroupLayout.Alignment.LEADING, 0, 133, Short.MAX_VALUE)
                    .addComponent(txt_Precio_Unitario, javax.swing.GroupLayout.Alignment.LEADING)))
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(299, 299, 299)
                        .addComponent(jLabel5))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(dp_diaOUT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lbl_horaOUT)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txt_1, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                    .addComponent(txt_Total)))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(txt_representante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbx_Tarifas_Hab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txt_Precio_Unitario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txt_Descuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4)))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(7, 7, 7)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(dp_diaIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_horaIN, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(7, 7, 7)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(dp_diaOUT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_horaOUT)))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(txt_Total, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.LINE_AXIS));

        tbl_Cuentas_Huesped.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Fecha", "Hora", "Hab.", "Detalle", "Debe", "Haber"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(tbl_Cuentas_Huesped);

        jPanel3.add(jScrollPane3);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Hospedaje", new javax.swing.ImageIcon(getClass().getResource("/Imagenes/home.png")), jPanel5); // NOI18N

        lbl_titulo.setEditable(false);
        lbl_titulo.setBackground(new java.awt.Color(153, 153, 153));
        lbl_titulo.setFont(new java.awt.Font("Copperplate Gothic Light", 1, 18)); // NOI18N
        lbl_titulo.setForeground(new java.awt.Color(255, 255, 255));
        lbl_titulo.setText("Huespedes");
        lbl_titulo.setFocusable(false);

        panelRect1.setBackground(new java.awt.Color(255, 255, 255));
        panelRect1.setForeground(new java.awt.Color(255, 255, 255));
        panelRect1.setColorPrimario(new java.awt.Color(255, 255, 255));
        panelRect1.setColorSecundario(new java.awt.Color(102, 102, 102));
        panelRect1.setPreferredSize(new java.awt.Dimension(150, 184));

        btn_Capturar_Visitante.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/webmoney.png"))); // NOI18N
        btn_Capturar_Visitante.setText("<html><p>Capturar</p><p>Visitante</p></html>");
        btn_Capturar_Visitante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_Capturar_VisitanteActionPerformed(evt);
            }
        });

        btn_listarCaja.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Alpha Dista Icon 17.png"))); // NOI18N
        btn_listarCaja.setText("Check-OUT");
        btn_listarCaja.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_listarCajaActionPerformed(evt);
            }
        });

        btn_Capturar_Reserva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Close.png"))); // NOI18N
        btn_Capturar_Reserva.setText("Informes");

        btn_Ingresar_Mov.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/down.png"))); // NOI18N
        btn_Ingresar_Mov.setText("Check-IN");
        btn_Ingresar_Mov.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_Ingresar_MovActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelRect1Layout = new javax.swing.GroupLayout(panelRect1);
        panelRect1.setLayout(panelRect1Layout);
        panelRect1Layout.setHorizontalGroup(
            panelRect1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRect1Layout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addGroup(panelRect1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btn_listarCaja, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_Ingresar_Mov, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_Capturar_Reserva, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_Capturar_Visitante))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelRect1Layout.setVerticalGroup(
            panelRect1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRect1Layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addComponent(btn_Capturar_Visitante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btn_Capturar_Reserva, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btn_Ingresar_Mov)
                .addGap(18, 18, 18)
                .addComponent(btn_listarCaja)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jXTaskPane1.setCollapsed(true);
        org.jdesktop.swingx.VerticalLayout verticalLayout1 = new org.jdesktop.swingx.VerticalLayout();
        verticalLayout1.setGap(2);
        jXTaskPane1.getContentPane().setLayout(verticalLayout1);

        jXSearchField2.setText("jXSearchField2");
        jXTaskPane1.getContentPane().add(jXSearchField2);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(jXTaskPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRect1, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(lbl_titulo)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(lbl_titulo, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelRect1, javax.swing.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE)
                    .addComponent(jTabbedPane1)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 442, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jXTaskPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );

        jScrollPane1.setViewportView(jPanel1);

        add(jScrollPane1);
    }// </editor-fold>//GEN-END:initComponents

    private void btn_Capturar_VisitanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Capturar_VisitanteActionPerformed
//        JDialog frame;
//        if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
//            frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
//        } else {
//            frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
//        }
//        Vista_Visitante panel_captura_visitante = new Vista_Visitante(unaHosteria, huesped);
//        frame.getContentPane().removeAll();
//        frame.getContentPane().add(panel_captura_visitante);
//        frame.pack();
//        frame.setLocationRelativeTo(null);
//        frame.show();
//
//        Visitante unVisitante = (Visitante) panel_captura_visitante.getSelected_Visitante().getValueAt(panel_captura_visitante.getSelected_Visitante().getSelectedRow(), 0);
//        txt_representante.setText(unVisitante.getApellido() + " " + unVisitante.getNombre());
//        txt_apellido_vis.setText(unVisitante.getApellido());
//        txt_Nombre_Vis.setText(unVisitante.getNombre());
//        txt_ocupacion.setText(unVisitante.getOcupacion());
//        txt_motivoVis.setText(unVisitante.getMotivo_visita());
//        txt_telefono.setText(unVisitante.getTelefono());
//        txt_EstadoCivil.setText(unVisitante.getEstado_civil().toString());
//        txt_Email_Vis.setText(unVisitante.getE_mail());
//        txt_sexoVis.setText(unVisitante.getSexo().toString());
//        txt_Pais_vis.setText(unVisitante.getDireccion().getPais().toString());
//        txt_Porvincia_Vis.setText(unVisitante.getDireccion().getProvincia().toString());
//        txt_Localidad_Vis.setText(unVisitante.getDireccion().getLocalidad().toString());
//        txt_Domicilio_Vis.setText(unVisitante.getDomicilio());
//        txt_CondAf_Vis.setText(unVisitante.getCondicion_af());
//        txt_Documento_Vis.setText(unVisitante.getDni());
//        txt_FechaNac_Vis.setText(unVisitante.getFnac().toString());
    }//GEN-LAST:event_btn_Capturar_VisitanteActionPerformed

    private void btn_Ingresar_MovActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Ingresar_MovActionPerformed
        JDialog frame;
        if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
            frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
        } else {
            frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
        }
        Check_IN out = new Check_IN(unaHosteria, null);
        frame.getContentPane().removeAll();
        frame.getContentPane().add(out);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.show();
    }//GEN-LAST:event_btn_Ingresar_MovActionPerformed

    private void btn_listarCajaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_listarCajaActionPerformed
        Hospedaje unHospedaje = (Hospedaje) tbl_hospedajes.getValueAt(tbl_hospedajes.getSelectedRow(), 1);
        JDialog frame;
        if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
            frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
        } else {
            frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
        }
        Check_OUT out = new Check_OUT(unaHosteria, unHospedaje);
        frame.getContentPane().removeAll();
        frame.getContentPane().add(out);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.show();
    }//GEN-LAST:event_btn_listarCajaActionPerformed

    private void txt_Precio_UnitarioCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txt_Precio_UnitarioCaretUpdate
        calcularDescuento();
    }//GEN-LAST:event_txt_Precio_UnitarioCaretUpdate
    private Hosteria unaHosteria;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_Capturar_Reserva;
    private javax.swing.JButton btn_Capturar_Visitante;
    private javax.swing.JButton btn_Ingresar_Mov;
    private javax.swing.JButton btn_listarCaja;
    private javax.swing.JComboBox cbx_Tarifas_Hab;
    private org.jdesktop.swingx.JXDatePicker dp_diaIN;
    private org.jdesktop.swingx.JXDatePicker dp_diaOUT;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private org.jdesktop.swingx.JXSearchField jXSearchField2;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane1;
    private javax.swing.JLabel lbl_horaIN;
    private javax.swing.JLabel lbl_horaOUT;
    private javax.swing.JLabel lbl_tipoDNI;
    private javax.swing.JTextField lbl_titulo;
    private org.edisoncor.gui.panel.PanelRect panelRect1;
    private javax.swing.JTable tbl_Cuentas_Huesped;
    private javax.swing.JTable tbl_hospedajes;
    private javax.swing.JTextField txt_1;
    private javax.swing.JTextField txt_CondAf_Vis;
    private javax.swing.JTextField txt_Descuento;
    private javax.swing.JTextField txt_Documento_Vis;
    private javax.swing.JTextField txt_Domicilio_Vis;
    private javax.swing.JTextField txt_Email_Vis;
    private javax.swing.JTextField txt_EstadoCivil;
    private javax.swing.JTextField txt_FechaNac_Vis;
    private javax.swing.JTextField txt_Localidad_Vis;
    private javax.swing.JTextField txt_Nombre_Vis;
    private javax.swing.JTextField txt_Pais_vis;
    private javax.swing.JTextField txt_Porvincia_Vis;
    private javax.swing.JTextField txt_Precio_Unitario;
    private javax.swing.JTextField txt_Total;
    private javax.swing.JTextField txt_apellido_vis;
    private javax.swing.JTextField txt_motivoVis;
    private javax.swing.JTextField txt_nro_carnet;
    private javax.swing.JTextField txt_ocupacion;
    private javax.swing.JTextField txt_representante;
    private javax.swing.JTextField txt_sexoVis;
    private javax.swing.JTextField txt_telefono;
    // End of variables declaration//GEN-END:variables

    private int calcularTotal(Hospedaje unHospedaje) {
   Calendar entrada = Calendar.getInstance();
        Calendar salida = Calendar.getInstance();
        entrada.setTime(unHospedaje.getEntrada());
        salida.setTime(unHospedaje.getSalida());
        int cantDias = salida.get(Calendar.DAY_OF_MONTH) - entrada.get(Calendar.DAY_OF_MONTH);
        if (cantDias == 0) {
            cantDias = 1;
        }
        return (cantDias);
    }
    
        private void calcularDescuento() {
        Hospedaje unHospedaje = (Hospedaje) tbl_hospedajes.getValueAt(tbl_hospedajes.getSelectedRow(), 1);
        if (!txt_Precio_Unitario.getText().isEmpty()) {
            Double precioUnitario = Double.parseDouble(txt_Precio_Unitario.getText());
            if (txt_Descuento.getText().isEmpty()) {
                txt_Total.setText(String.valueOf((unHospedaje.getUnaTarifa_Habitacion().getPrecio()) * (calcularTotal(unHospedaje))));
                txt_Total.setText(String.valueOf(precioUnitario));
            } else {
                Double descuentoUnitario = Double.parseDouble(txt_Descuento.getText());
                Double totalPrecio = precioUnitario - ((descuentoUnitario * precioUnitario) / 100);
                txt_Total.setText(String.valueOf(totalPrecio));
                txt_Total.setText(String.valueOf((totalPrecio) * (calcularTotal(unHospedaje))));
            }
        }
    }
}
